home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Programming / LEDA / incl / LEDA.020+881 / graph_alg.h < prev    next >
C/C++ Source or Header  |  1994-08-05  |  6KB  |  188 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  3.1c
  4. +
  5. +
  6. +  graph_alg.h
  7. +
  8. +
  9. +  Copyright (c) 1994  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #ifndef LEDA_GRAPHALG_H
  16. #define LEDA_GRAPHALG_H
  17.  
  18. #include <LEDA/graph.h>
  19. #include <LEDA/ugraph.h>
  20. #include <LEDA/node_matrix.h>
  21.  
  22.  
  23. //-----------------------------------------------------------------------------
  24. // basic graph algorithms:
  25. //-----------------------------------------------------------------------------
  26.  
  27. bool        TOPSORT(const graph& G, node_array<int>& ord);
  28.  
  29. bool        TOPSORT1(graph& G);
  30.  
  31. list<node>  DFS(const graph& G, node s, node_array<bool>& reached) ;
  32.  
  33. list<node>  BFS(const graph& G, node s, node_array<int>& dist);
  34.  
  35. list<edge>  DFS_NUM(const graph& G, node_array<int>& dfsnum, 
  36.                                     node_array<int>& compnum);
  37.  
  38. int         COMPONENTS(const ugraph& G, node_array<int>& compnum);
  39.  
  40. int         COMPONENTS1(const ugraph& G, node_array<int>& compnum);
  41.  
  42. int         STRONG_COMPONENTS(const graph& G, node_array<int>& compnum);
  43.  
  44. int         STRONG_COMPONENTS1(const graph& G, node_array<int>& compnum);
  45.  
  46. int         BICONNECTED_COMPONENTS(const ugraph& G, edge_array<int>& compnum);
  47.  
  48. graph       TRANSITIVE_CLOSURE(const graph& G);
  49.  
  50.  
  51.  
  52. //-----------------------------------------------------------------------------
  53. // shortest paths:
  54. //-----------------------------------------------------------------------------
  55.  
  56. void DIJKSTRA(const graph& G, node s, const edge_array<int>& cost, 
  57.                                             node_array<int>& dist, 
  58.                                             node_array<edge>& pred);
  59.  
  60. bool BELLMAN_FORD(const graph& G, node s, const edge_array<int>& cost,
  61.                                                 node_array<int>& dist,
  62.                                                 node_array<edge>& pred);
  63.  
  64. bool ALL_PAIRS_SHORTEST_PATHS(graph& G, const edge_array<int>&  cost,
  65.                                               node_matrix<int>& dist);
  66.  
  67.  
  68.  
  69.  
  70. //-----------------------------------------------------------------------------
  71. // maximum flow:
  72. //-----------------------------------------------------------------------------
  73.  
  74.  
  75. int  MAX_FLOW(graph& G, node s, node t, const edge_array<int>& cap,
  76.                                               edge_array<int>& flow);
  77.  
  78. //-----------------------------------------------------------------------------
  79. // min cost flow:
  80. //-----------------------------------------------------------------------------
  81.  
  82. int MIN_COST_MAX_FLOW(graph& G, node s, node t, const edge_array<int>& cap,
  83.                                                 const edge_array<int>& cost,
  84.                                                 edge_array<int>& flow);
  85.  
  86.  
  87. //-----------------------------------------------------------------------------
  88. // matchings:
  89. //-----------------------------------------------------------------------------
  90.  
  91. // Edmond's algorithm
  92.  
  93. list<edge> MAX_CARD_MATCHING(graph& G, int heur = 1);    
  94.  
  95.  
  96. // Hopcroft/Karp
  97.  
  98. list<edge> MAX_CARD_BIPARTITE_MATCHING(graph& G, const list<node>& A, const list<node>& B);
  99.  
  100. list<edge> MAX_CARD_BIPARTITE_MATCHING(graph& G);
  101.  
  102. list<edge> MAX_CARD_BIPARTITE_MATCHING1(graph& G, const list<node>& A, const list<node>& B);
  103.  
  104. list<edge> MAX_CARD_BIPARTITE_MATCHING1(graph& G);
  105.  
  106.  
  107.  
  108. list<edge> MAX_WEIGHT_BIPARTITE_MATCHING(graph& G, const list<node>&A, 
  109.                                                    const list<node>&B,
  110.                                                    const edge_array<int>&);
  111.  
  112.  
  113.  
  114.  
  115. //-----------------------------------------------------------------------------
  116. // spanning trees:
  117. //-----------------------------------------------------------------------------
  118.  
  119. list<edge> SPANNING_TREE(const graph& G);
  120.  
  121. list<edge> MIN_SPANNING_TREE(const graph& G, const edge_array<int>& cost);
  122.  
  123. list<edge> MIN_SPANNING_TREE(const ugraph& G, const edge_array<int>& cost);
  124.  
  125.  
  126.  
  127. //-----------------------------------------------------------------------------
  128. // planar graphs
  129. //-----------------------------------------------------------------------------
  130.  
  131. bool PLANAR(graph&, bool embed=false);
  132.  
  133. bool PLANAR(graph&, list<edge>&, bool embed=false);
  134.  
  135. void make_biconnected_graph(graph&G);
  136.  
  137. list<edge> TRIANGULATE_PLANAR_MAP(graph&);
  138.  
  139. int STRAIGHT_LINE_EMBEDDING(graph& G,node_array<int>& xcoord,
  140.                                      node_array<int>& ycoord);
  141.  
  142. int STRAIGHT_LINE_EMBEDDING2(graph& G,node& a, node& b, node& c,
  143.                              node_array<int>& xcoord,node_array<int>& ycoord);
  144.  
  145.  
  146. //-----------------------------------------------------------------------------
  147. // "REAL" versions 
  148. //-----------------------------------------------------------------------------
  149.  
  150.  
  151. void DIJKSTRA(const graph& G, node s, const edge_array<double>& cost, 
  152.                                             node_array<double>& dist, 
  153.                                             node_array<edge>& pred);
  154.  
  155. bool BELLMAN_FORD(const graph& G, node s, const edge_array<double>& cost,
  156.                                                 node_array<double>& dist,
  157.                                                 node_array<edge>& pred);
  158.  
  159.  
  160. bool ALL_PAIRS_SHORTEST_PATHS(graph& G, const edge_array<double>&  cost,
  161.                                               node_matrix<double>& dist);
  162.  
  163.  
  164. double MAX_FLOW(graph& G, node s, node t, const edge_array<double>& cap,
  165.                                                 edge_array<double>& flow);
  166.  
  167.  
  168. list<edge> MAX_WEIGHT_BIPARTITE_MATCHING(graph& G, const list<node>&, 
  169.                                                    const list<node>&,
  170.                                                    const edge_array<double>&);
  171.  
  172.  
  173.  
  174. int STRAIGHT_LINE_EMBEDDING(graph& G,node_array<double>& xcoord,
  175.                                      node_array<double>& ycoord);
  176.  
  177. int STRAIGHT_LINE_EMBEDDING2(graph& G,node_array<double>& xcoord,
  178.                                       node_array<double>& ycoord);
  179.  
  180.  
  181. list<edge> MIN_SPANNING_TREE(const graph& G, const edge_array<double>& cost);
  182.  
  183. list<edge> MIN_SPANNING_TREE(const ugraph& G, const edge_array<double>& cost);
  184.  
  185.  
  186. #endif
  187.